/* 
 * Author      		: Adnin Devit CF 
 * Date Created		: 31-Maret-2011 
 * Date Modified	: 6-April-2011 
 * Version			: 1.1 
 * */
package jtk.project4.fleet.field;

import javax.swing.SortOrder;

import org.hsqldb.Table;

//import jtk.project4.fleet.domain.MaintenanceHistory;
import nl.coderight.jazz.form.FormLayout;
import nl.coderight.jazz.form.control.GroupControl;
import nl.coderight.jazz.form.field.TableField;
import nl.coderight.jazz.form.field.TableField.AutoResizeMode;

public class MaintenanceHistoryMaintenanceTaskTableField extends GroupControl<String>{
	
	private TableField<String> maintenanceTaskTable;
	public MaintenanceHistoryMaintenanceTaskTableField(String bindID){
		//setTitle("header.MaintenanceHistory");
		setBindID(bindID);
		createFields();
		createLayout();
	}
	
	private void createFields(){
		maintenanceTaskTable = new TableField<String>("MaintenanceTaskTable","MaintenanceTask");
		//maintenanceTaskTable.setTitle("MaintenanceHistory.header.table");
		maintenanceTaskTable.setAutoResizeMode(AutoResizeMode.AUTOFIT);
		maintenanceTaskTable.getSelectionValues();
		
		maintenanceTaskTable.addColumn("label.date","date");
		maintenanceTaskTable.addColumn("label.maintenanceTask","maintenanceTask");
		maintenanceTaskTable.addColumn("label.partCost","partCost");
		maintenanceTaskTable.addColumn("label.laborCost","laborCost");
		maintenanceTaskTable.addColumn("label.totalCost","totalCost");
		
		maintenanceTaskTable.sort("date", SortOrder.ASCENDING);
	}
	
	private void createLayout(){
		setLayout (new FormLayout())
		.addField(maintenanceTaskTable);	
	}
}
